import request from '@/utils/request'

/**
 * 用户登陆
 * @author chengh
 * @param data 用户名密码
 */
export function login(username, password, code, uuid) {
  const data = {
    username,
    password,
    code,
    uuid
  }
  return request({
    url: '/login/userLogin',
    method: 'post',
    data: data
  })
}

export function getInfo() {
  return request({
    url: '/system/user/info',
    method: 'get'
  })
}

export function logout() {
  return request({
    url: '/login/userLogout',
    method: 'post'
  })
}

/**
 * 获取用户的树形菜单列表
 * @author chengh
 * @returns {AxiosPromise}
 */
export function getRoutes() {
  return request({
    url: '/system/menu/menusByUserId',
    method: 'get'
  })
}

/**
 * 获取验证码
 * @returns {AxiosPromise} 验证码
 */
export function getCodeImg() {
  return request({
    url: 'login/captchaImage',
    method: 'get'
  })
}
